package edu.ptit.jad.preprocess.app;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;

import edu.ptit.jad.configuration.CONSTANTS;
import edu.ptit.jad.data.DataAccess;
import edu.ptit.jad.exception.AdException;
import edu.ptit.jad.model.Document;

/**
 * 
 * @author PhuongDo Remove stopwords, sysnonym...
 * 
 */
public class DocumentFilter extends Filter {

	public DocumentFilter(String output) {
		super(output);
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) throws Exception {

		Filter filter = new DocumentFilter(CONSTANTS.FILE_DATA_NEWS_PRE);
		// Filter filter = new DocumentFilter(CONSTANTS.FILE_DATA_NEWS_TD_PRE);
		filter.filter();

	}

	@Override
	List<String> getListDocs() {

		List<Document> docs;
		List<String> strs = new ArrayList<String>();
		try {
			docs = DataAccess.getInstance().getDocuments(
					CONSTANTS.FILE_DATA_TOK_NEWS);

			for (Document d : docs) {
				strs.add(d.getTitle() + " " + d.getSummary() + " "
						+ d.getContent());

			}

		} catch (AdException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return strs;

	}

}
